#ifndef __MEMORYSTREAM_H__
#define __MEMORYSTREAM_H__

#include "TypeDef.h"
#include "Stream.h"

namespace Woo {
namespace IO {

class MemoryStream :
	public Stream
{
public:
	MemoryStream();
	MemoryStream(const Byte* buffer, UInt32 bufferSize);
	virtual ~MemoryStream();

	virtual UInt32 GetLength();
	virtual UInt32 GetPosition();
	virtual void SetPosition(UInt32 position);
	virtual UInt32 Write(const Byte* buffer, UInt32 bufferSize);
	virtual UInt32 Read(Byte* buffer, UInt32 bufferSize);
	virtual void Close();
	virtual bool IsClosed();
	virtual bool CanRead();
	virtual bool CanWrite();

private:
	vector<Byte>	m_vBuffer;
	UInt32			m_vPos;
	bool			m_hasClosed;
};

} // namespace IO
} // namespace Woo

#endif // define __MEMORYSTREAM_H__
